import request from '@/utils/request'

// 登录方法
export function login(username, password, code, uuid) {
    const data = {
        username,
        password,
        code,
        uuid
    }
    return request({
        url: '/admin-api/system/auth/enterprise-login',
        // url: '/login',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

export function smsLogin(data) {
    return request({
        url: '/smsLogin',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

export function forgetPassword(data) {
    return request({
        url: '/forgetPassword',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

// 注册方法(普通用户)
export function register(data) {
    return request({
        url: '/register',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

// 注册方法(经销商)
export function companyRegister(data) {
    return request({
        url: '/companyRegister',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

// 获取手机验证码(注册)
export function getPhoneCode(data) {
    return request({
        url: '/getPhoneCode',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

// 获取手机验证码(找回密码)
export function getCode(data) {
    return request({
        url: '/getCode',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

// 获取短信验证码(登录)
export function getSmsCode(data) {
    return request({
        url: '/getSmsCode',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

// 获取用户详细信息
export function getInfo() {
    return request({
        url: '/admin-api/system/auth/get-permission-info-ry',
        method: 'get'
    })
}

// 退出方法
export function logout() {
    return request({
        url: '/admin-api/system/auth/logout',
        method: 'post'
    })
}

// 记录项目
export function record(data) {
    return request({
        url: '/business/project/record',
        method: 'post',
        data: data
    })
}

// 获取验证码
export function getCodeImg() {
    return request({
        url: '/captchaImage',
        headers: {
            isToken: false
        },
        method: 'get',
        timeout: 20000
    })
}
